﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.IO;

namespace student_systemApp
{
    public partial class ListGradeForm : Form
    {
        public ListGradeForm()
        {
            InitializeComponent();
        }
        private void ListGradeForm_Load(object sender, EventArgs e)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["UserManagementConnectionString"].ConnectionString;
            string sql = "SELECT * FROM grade;";
            
            using (var connection = new MySqlConnection(connectionString))
            {
                try
                {
                    connection.Open();
                    var adapter = new MySqlDataAdapter(sql, connection);
                    var dataTable = new DataTable();
                    adapter.Fill(dataTable);
                    // 将 DataTable 绑定到 DataGridView 控件
                    dgv_listGrade.DataSource = dataTable;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("查找失败" + ex.Message, "提示");
                }
                connection.Close();
            }
        }
        private void dgv_listGrade_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
        }
    }
}
